/**
 * CodeMsg.java 
 * Copyright © 2014-2016, 杭州泊享网络科技有限公司
 * 
 * @author wen long hua
 * @create 2015年6月2日
 */
package com.pshare.enums;

import java.util.HashMap;
import java.util.Map;

import com.pshare.constant.SeaxConstants;

/**
 * 自定义银行代码和名称
 */
public enum BankCode {

	ICBC("ICBC", "B100001", "中国工商银行"),

    ABC("ABC", "B100002", "中国农业银行"),

    BOCSH("BOCSH", "B100003", "中国银行"),

    CCB("CCB", "B100004", "中国建设银行"),

    CMB("CMB", "B100005", "招商银行"),

    PFB("PFB", "B100006", "浦发银行"),

    CEB("CEB", "B100007", "光大银行"),

    PINGAN("PINGAN", "B100008", "平安银行"),

    HXB("HXB", "B100009", "华夏银行"),

    CIB("CIBC", "B1000010", "兴业银行"),

    ZXB("CNCB", "B1000011", "中信银行"),

    POSTGC("POSTGC", "B1000012", "邮政储蓄银行"),

    CMBCD("CMBCD", "B1000013", "民生银行"),

    GDB("GDB", "B1000014", "广发银行"),

    SDB("SDB", "B1000015", "深圳发展银行"),

    COMM("COMM", "B1000016", "交通银行"),
	
	HZBANK("HZBANK", "B1000017", "杭州银行"),
	
	HZUNITEDBANK("HZUNITEDBANK", "B1000018", "杭州联合银行");
	
	private String en_name;
	private String code;
	private String cn_Name;
	private static Map<String, String> cnmap = new HashMap<String, String>();
	private static Map<String, String> enmap = new HashMap<String, String>();
	
	static {
		initMaps();
	}

	private BankCode(String en_name, String code, String cn_Name) {
		this.code = code;
		this.en_name = en_name;
		this.cn_Name = cn_Name;
	}
	public String getEn_name() {
		return en_name;
	}
	public void setEn_name(String en_name) {
		this.en_name = en_name;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}

	

	public String getCn_Name() {
		return cn_Name;
	}
	public void setCn_Name(String cn_Name) {
		this.cn_Name = cn_Name;
	}
	public static Map<String, String> getCnmap() {
		return cnmap;
	}

	public static void setCnmap(Map<String, String> cnmap) {
		BankCode.cnmap = cnmap;
	}

	public static Map<String, String> getEnmap() {
		return enmap;
	}

	public static void setEnmap(Map<String, String> enmap) {
		BankCode.enmap = enmap;
	}

	private static void initMaps() {
		for (BankCode em : BankCode.values()) {
			cnmap.put(em.getCode(), em.getCn_Name());
			enmap.put(em.getCode(), em.getEn_name());
		}
	}

	public static String getMsg(Integer code, Boolean isEn) {
		String msg = null;
		if (isEn) {
			msg = enmap.get(code);
		} else {
			msg = cnmap.get(code);
		}
		return msg == null ? SeaxConstants.EMPTY : msg;
	}
}
